package org.example;

public class Test2 {
    //leetcode 576 摆动序列 https://leetcode.cn/problems/wiggle-subsequence/description/
    public int wiggleMaxLength(int[] nums) {
        int ret = 1, prev = 0, i = 1;
        while (i < nums.length) {
            while (i < nums.length && nums[i] - nums[i - 1] == 0) {
                i++;
            }
            if (i >= nums.length) break;
            int div = nums[i] - nums[i - 1];
            if (div * prev <= 0) {
                ret++;
                prev = nums[i] - nums[i - 1];
            }
            i++;
        }
        return ret;
    }

    public static void main(String[] args) {
        Test2 test2 = new Test2();
        int[] arr = {0,0};
        test2.wiggleMaxLength(arr);
        System.out.println(666);
    }
}
